<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>黑马银行</title>
    <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
    <script>
        $(function () {
            $("#loginForm").submit(function () {
                $.post("/login", $(this).serialize(), function (data) {
                    if (data.code == 1000) {
                        location.href = "home.html";
                    } else {
                        $("#error_msg").html(data.msg);
                    }
                }, "json");
                return false;
            });
        });
    </script>
</head>
<body>
<center>
    <h1>欢迎登陆黑马网上银行</h1>
    <form action="bankServlet" method="post" id="loginForm">
        <input type="hidden" name="method_name" value="_login">
        <table border="1" bordercolor="gold" cellspacing="0" cellpadding="5" width="">
            <tr>
                <td>账号:</td>
                <td><input type="text" name="accountid"></td>
            </tr>
            <tr>
                <td>密码:</td>
                <td><input type="password" name="password"></td>
            </tr>
            <tr>
                <td colspan=2 align="center">
                    <input type="submit" value=" 登 陆 "/>&nbsp;
                    <input type="reset" value=" 重 置 "/>
                </td>
            </tr>
        </table>
    </form>
    <br><br>
    <font color="red" size="5" id="error_msg"></font>
</center>
</body>
</html>